<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<link href="${ctx}/css/main/base.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/css/main/main.css" rel="stylesheet" type="text/css" />
<script src="scripts/inframe.js"></script>
<body>
<div id="info"><font color="red">${info}</font></div>
<form action="${ctx}/titleClass/class_modify.action" method="post">

<input type="hidden" name="classCode" value="${titleClass.classCode }" />
<input type="hidden" name="titleClass.classId" value="${titleClass.classId }" />

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab_m">
  <tr>
    <td colspan="2" class="zctop"><span class="font14 zc_bt">修改功能主分类</span></td>
    </tr>
  <tr>
    <td class="w1">功能编号：</td>
    <td class="w2 left">
   
	<select name="titleClass.classCode" class="fl_l">
		<s:iterator value="sysMenus" status="sysMenu">
			<option value="${menuCode}" <s:if test="menuCode == titleClass.classCode">selected</s:if>>
				${menuName}
			</option>
		</s:iterator>
	</select>
	
   <div id="errCode"></div>
   </td>
  </tr>
  <tr>
    <td class="w1">功能名称：</td>
    <td class="w2 left"><input type="text" name="titleClass.className" class="fl_l" value="${titleClass.className }" /><div id="errName"></div></td>
  </tr>
  <tr>
    <td colspan="2" class="hei_1">
    <input type="button" onclick="modifyClass();" value="确 定" class="log_f zc_b">
	<input type="button" onclick="returnClass();" value="返 回" class="log_f zc_b">
    </td>
    </tr>
</table>
</form>
</body>
</html>
<script type="text/javascript" src="${ctx}/scripts/commons/validation.js"></script>
<script type="text/javascript">

	function modifyClass(){
		var code = document.getElementById("titleClass.classCode").value ;
		var name = document.getElementById("titleClass.className").value;		

	var flag1 = /^[0-9]{2}$/;
	if(!flag1.test(code)){
		document.getElementById("errCode").innerHTML = "<font color='red'>编号必须是两位数字</font>";
	   return false;
	}
	if(code.length > 2){
		document.getElementById("errCode").innerHTML = "<font color='red'>编号必须是两位数字</font>";
	   return false;
	}
	if(code.length == 0 && name.length == 0){
	   document.getElementById("errName").innerHTML = "<font color='red'>不能添加空的功能节点</font>";
	   return false;
	}
	if(name == '' || name.length == 0){
	   document.getElementById("errName").innerHTML = "<font color='red'>功能名称不能为空</font>";
	   return false;
	}

	if(name.length > 0 && hasSpecialChart(name)){
			document.getElementById("errName").innerHTML = "<font color='red'> 功能名称不能有特殊字符!</font>";
			return false;
	}
	if(name.length > 50){
	   document.getElementById("errName").innerHTML = "<font color='red'>功能名称不能超过50</font>";
	   return false;
	}
	if(name.length > 0 && (code.length == 0)){
	   document.getElementById("errName").innerHTML = "<font color='red'>功能编号不能为空</font>";
	   return false;
	}
	 
	 document.forms[0].submit();		 
	}
	
	
	function returnClass(){
		document.getElementById("titleClass.classCode").value = "";
		document.getElementById("titleClass.className").value = "";
		
		history.go(-1);
	}
</script>
